let currentPage = 1;
let totalPageCount = 0;
let s = encodeURI(window.location.href);
//分离出ID
let valuesIDs = s.split("?pid=");
//分离出携带的值
let pids=0;
pids=valuesIDs[1];
$(function () {
    $.ajax({
        url: path+"/blog/getBlogById",
        type: "GET",
        data: {"pid": pids},
        success: function (data) {
            $(".cl-artical-content").append("<h2 class='cl-artical-title'>" + data.title + "</h2>\n" +
                "                <div class='cl-card-tag'>\n" +
                "                    <div><span>" + formatDate(data.createTime) + "</span></div>\n" +
                "                </div>\n" +
                "                <div class='cl-artical'>\n" + data.content +
                "                    \n" +
                "                </div>")
        }
    })

})

//时间戳转换方法    date:时间戳数字
function formatDate(date) {
    var date = new Date(date);
    var YY = date.getFullYear() + '-';
    var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
    var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
    var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
    var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
    var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
    return YY + MM + DD + " " + hh + mm + ss;
}

